<meta charset="utf-8" />
<link rel="stylesheet" href="./渐变布局.css">
<h1>❥(^_-)vip</h1>

<div class="vip"></div>
<script>
    // 获取H5数据
    let sessionUname = sessionStorage.getItem('uname')
    // 判断 当前时间是不是大于存的时间----是-过期---不是-继续使用
    let localUname = (new Date).getTime() > localStorage.getItem('expires') ? null : localStorage.getItem('uname')
    
    let uname = sessionUname || localUname
    if (uname)
    {
    // uname有值-登录成功：显示vip名和退出
    document.querySelector('.vip').innerHTML = `
        ${uname}
        <a href="./logout.html">退出</a>
    `
    } else {
    // uname没有值-不登录：显示a标签登录 然后跳转登录
    document.querySelector('.vip').innerHTML = `<a href="./login.html">没登录就来点我</a> `

}
</script>